import request from '@/config/axios'

export interface UnitVO {
  id: number
  name: string
  nameShort: string
  address: string
  postalId: string
  email: string
  unitType: number
  linkman1: string
  linkman1Phone: string
  linkman2: string
  linkman2Phone: string
  remark: string
}

// 查询单位管理列表
export const getUnitPage = (params: PageParam) => {
  return request.get({ url: '/system/unit/page', params })
}

// 查询单位详情
export const getUnit = (id: number) => {
  return request.get({ url: '/system/unit/get?id=' + id })
}

// 新增单位
export const createUnit = (data: UnitVO) => {
  return request.post({ url: '/system/unit/create', data })
}

// 修改单位
export const updateUnit = (data: UnitVO) => {
  return request.put({ url: '/system/unit/update', data })
}

// 删除单位
export const deleteUnit = (id: number) => {
  return request.delete({ url: '/system/unit/delete?id=' + id })
}
// 批量删除单位
export const deleteUnitList = (ids: Array<number>) => {
  return request.delete({ url: '/system/unit/deleteByIds?ids=' + ids })
}
